"""\
This file provides to get or save controller setting.

ControllerEventNameGet()
    Get controller setting from file or from default setting
    (DefaultConfigure.py).

ControllerEventNameSave(EventName)
    Save controller setting to file

ControllerEventNameDefaultGet()
    Get default controller setting from DefaultConfigure.py

ControllerConfigure()
    overwrite event name of controller.
"""

import EventDefine # configure controller event
from Shell.configure.ConfigureAccess import ConfigureGet,ConfigureSave,DefaultConfigureGet

# for ConfigureFrame ------------------------------------------------
def ControllerEventNameGet():
    """\
ControllerEventNameGet()
    Get controller setting."""
    ret = ConfigureGet("ControllerEventName")
    return ret

def ControllerEventNameSave(EventName):
    """\
ControllerEventNameSave(EventName)
    Save controller setting to file

    Parameters:
        EventName    ( type = dict )"""
    ConfigureSave({"ControllerEventName":EventName})

def ControllerEventNameDefaultGet():
    """\
ControllerEventNameDefaultGet()
    Get default controller setting from DefaultConfigure.py"""
    ret = DefaultConfigureGet("ControllerEventName")
    return ret

def ControllerConfigure():
    """\
ControllerConfigure()
    overwrite event name of controller."""
    EventName = ControllerEventNameGet()
    EventDefine.event_CONTROLLER_UP = EventName["UP"]
    EventDefine.event_CONTROLLER_LEFT = EventName["LEFT"]
    EventDefine.event_CONTROLLER_RIGHT = EventName["RIGHT"]
    EventDefine.event_CONTROLLER_BTN0 = EventName["FIRE"]
